#ifndef _CEMITTER_
#define _CEMITTER_
#include <iostream>
#include <windows.h>
#include <vector>
using namespace std;

class CParticle;
class CEmitter
{
	float				m_fPosX;
	float				m_fPosY;

	vector<CParticle*>	m_vParticles;

	int					m_nEmitterSize;
	int					m_nEmitterType;
	int					m_nEmitterLife;
	int					m_nParticlesPerSec;
	int					m_nSourceBlendID;
	int					m_nDestinationBlendID;

	int					m_nParticleStartAlpha;
	int					m_nParticleStartRed;
	int					m_nParticleStartGreen;
	int					m_nParticleStartBlue;

	int					m_nParticleEndAlpha;
	int					m_nParticleEndRed;
	int					m_nParticleEndGreen;
	int					m_nParticleEndBlue;

	float				m_fParticleStartScale;
	float				m_fParticleEndScale;

	int					m_nParticleLifeMin;
	int					m_nParticleLifeMax;

	float				m_fParticleVelMinX;
	float				m_fParticleVelMaxX;
	float				m_fParticleVelMinY;
	float				m_fParticleVelMaxY;

	float				m_fParticleAccelMinX;
	float				m_fParticleAccelMaxX;
	float				m_fParticleAccelMinY;
	float				m_fParticleAccelMaxY;

	int					m_nParticleImageID;

	bool				m_bIsActive;

	float				m_fParticleTimer;
	int*				m_pEmitterID;

	bool				m_bLooping;

public:
	CEmitter();
	~CEmitter();

	void SetPosX(float fPosX) {m_fPosX = fPosX;}
	void SetPosY(float fPosY) {m_fPosY = fPosY;}

	void SetEmitterSize(int nEmitterSize){ m_nEmitterSize = nEmitterSize;}
	void SetEmitterType(int nEmitterType){ m_nEmitterType = nEmitterType;}
	void SetEmitterLife(int nEmitterLife){ m_nEmitterLife = nEmitterLife;}
	void SetParticlesPerSec(int nParticlesPerSec){ m_nParticlesPerSec = nParticlesPerSec;}
	void SetSourceBlendID(int nSourceBlendID){ m_nSourceBlendID = nSourceBlendID; }
	void SetDestinationBlendID(int nDestinationBlendID) { m_nDestinationBlendID = nDestinationBlendID; }
	
	void SetParticleStartAlpha(int nStartAlpha){ m_nParticleStartAlpha = nStartAlpha;}
	void SetParticleStartRed(int nStartRed){ m_nParticleStartRed = nStartRed;}
	void SetParticleStartGreen(int nStartGreen){ m_nParticleStartGreen = nStartGreen;}
	void SetParticleStartBlue(int nStartBlue){ m_nParticleStartBlue = nStartBlue;}

	void SetParticleEndAlpha(int nEndAlpha){ m_nParticleEndAlpha = nEndAlpha;}
	void SetParticleEndRed(int nEndRed){ m_nParticleEndRed = nEndRed;}
	void SetParticleEndGreen(int nEndGreen){ m_nParticleEndGreen = nEndGreen;}
	void SetParticleEndBlue(int nEndBlue){ m_nParticleEndBlue = nEndBlue;}

	void SetParticleStartScale(float fStartScale){ m_fParticleStartScale = fStartScale;}
	void SetParticleEndScale(float fEndScale){ m_fParticleEndScale = fEndScale;}

	void SetParticleMinLife(int nMinLife) { m_nParticleLifeMin = nMinLife; }
	void SetParticleMaxLife(int nMaxLife) { m_nParticleLifeMax = nMaxLife; }

	void SetParticleVelMinX(float fVelMinX) { m_fParticleVelMinX = fVelMinX; }
	void SetParticleVelMaxX(float fVelMaxX) { m_fParticleVelMaxX = fVelMaxX; }
	void SetParticleVelMinY(float fVelMinY) { m_fParticleVelMinY = fVelMinY; }
	void SetParticleVelMaxY(float fVelMaxY) { m_fParticleVelMaxY = fVelMaxY; }

	void SetParticleAccelMinX(float fAccelMinX) { m_fParticleAccelMinX = fAccelMinX; }
	void SetParticleAccelMaxX(float fAccelMaxX) { m_fParticleAccelMaxX = fAccelMaxX; }
	void SetParticleAccelMinY(float fAccelMinY) { m_fParticleAccelMinY = fAccelMinY; }
	void SetParticleAccelMaxY(float fAccelMaxY) { m_fParticleAccelMaxY = fAccelMaxY; }

	void SetParticleID(int nID){ m_nParticleImageID = nID; }

	void SetIsActive(bool bIsActive){ m_bIsActive = bIsActive;}

	DWORD* GetColor(int ColorID);

	int GetEmitterLife() {return m_nEmitterLife;}
	bool GetIsActive() {return m_bIsActive;}

	int GetSourceBlend(){return m_nSourceBlendID;}
	int GetDestBlend(){return m_nDestinationBlendID;}

	int* GetEmitterID(){return m_pEmitterID;}
	void SetEmitterID(int pID){*m_pEmitterID = pID;}
	void SetEmitterID(int* pID){m_pEmitterID = pID;}


	void SetLooping(bool bLooping){ m_bLooping = bLooping;}

	void Update(float fElapsedTime);
	void Render();
};
#endif